import moment from "moment";
import { CurrencyTypes,PayChannel,FlowTypes } from '../../../utils/constant.js'

const FundListSearchKeys = [
    {
        key: "clientId",
        label: "客户名",
        placeholder: "请选择客户名",
        select: true,
        selectMode:'multiple',
        rules: [{
            required: false
        }],
    },
]
const FundListColumn =[
    { title: '资金账户名称', align: 'center', dataIndex:'name' }, 
    { title: '可用余额', align: 'center', dataIndex: 'balance', sorter:true, sortDirections:['descend','ascend'] }, 
    { title: '币种', align: 'center', dataIndex:'currencyType', customRender: text => { let tem = CurrencyTypes.filter(item =>{return item.key == text}); return tem[0] && tem[0].value ? tem[0].value : ''} }, 
    { title: '是否允许欠款', align: 'center', dataIndex:'allowArrearage', customRender: text => { return text ==1?'允许': '不允许' }}, 
    // { title: '会员折扣', align: 'center', dataIndex: 'name2', sorter:true, sortDirections:['descend','ascend'] }, 
    { title: '永久欠款额度', align: 'center', dataIndex:'arrearageAmount'  }, 
    // { title: '客户承担手续费比例', align: 'center', dataIndex:'id3', sorter:true, sortDirections:['descend','ascend']  }, 
    { title: '操作', align: 'center', scopedSlots: { customRender: 'operation' } }
]
const FundListModalKeys = [
    {
        key: "name",
        label: "资金账户名称",
        placeholder: "资金账户名称",
        input: true,
        maxLength: 50,
        rules: [{
            required: true,
            message: '资金账户名称'
        }],
    },
    {
        key: "allowArrearage",
        label: "是否允许欠款",
        switcher: true,
        rules: [{
            required: false,
            message: '是否允许欠款'
        }],
    },
    {
        key: "currencyType",
        label: "币种",
        placeholder: "请选择币种",
        select: true,
        rules: [{
            required: true,
            message: '请选择币种'
        }],
    },
    {
        key: "arrearageAmount",
        label: "永久额度",
        placeholder: "请输入永久额度",
        inputNumber: true,
        precision:2,
        maxLength:0,
        rules: [{
            required: true,
            message: '请输入永久额度'
        }],
    },
    // {
    //     key: "rat",
    //     label: "手续费客户承担比例",
    //     placeholder: "请输入手续费客户承担比例",
    //     inputNumber: true,
    //     precision:2,
    //     maxLength:0,
    //     rules: [{
    //         required: true,
    //         message: '请输入手续费客户承担比例'
    //     }],
    // },
    {
        key: "balance",
        label: "余额",
        placeholder: "请输入余额",
        inputNumber: true,
        precision:2,
        maxLength:0,
        rules: [{
            required: true,
            message: '请输入余额'
        }],
    },
    {
        key: "clientId",
        label: "客户",
        placeholder: "请选择客户",
        select: true,
        rules: [{
            required: true,
            message: '请选择客户'
        }],
    },
]
const FundListAddKeys = [
    {
        key: "type",
        label: "调账类型",
        placeholder: "请选择调账类型",
        select: true,
        rules: [{
            required: true,
            message: '请选择调账类型'
        }],
    },
    {
        key: "addedType",
        label: "交易类型",
        placeholder: "请选择交易类型",
        select: true,
        rules: [{
            required: true,
            message: '请选择交易类型'
        }],
    },
    {
        key: "channel",
        label: "支付渠道",
        placeholder: "请选择支付渠道",
        select: true,
        rules: [{
            required: true,
            message: '请选择支付渠道'
        }],
    },
    {
        key: "recordAmount",
        label: "净额$",
        placeholder: "净额$",
        inputNumber: true,
        rules: [{
            required: true,
            message: '净额$'
        }],
    },
    // {
    //     key: "billNumber",
    //     label: "流水号",
    //     placeholder: "请输入流水号",
    //     input: true,
    //     maxLength: 50,
    //     rules: [{
    //         required: true,
    //         message: '请输入流水号'
    //     }],
    // },
    // {
    //     key: "payNumber",
    //     label: "支付账号",
    //     placeholder: "请输入支付账号",
    //     input: true,
    //     maxLength: 50,
    //     rules: [{
    //         required: true,
    //         message: '请输入支付账号'
    //     }],
    // },
    // {
    //     key: "fee",
    //     label: "公司承担手续费",
    //     placeholder: "公司承担手续费",
    //     inputNumber: true,
    //     rules: [{
    //         required: true,
    //         message: '公司承担手续费'
    //     }],
    // },
    {
        key: "operateTime",
        label: "实际交易时间",
        placeholder: "实际交易时间",
        date: true,
        rules: [{
            required: false,
            message: '实际交易时间'
        }],
    },
    {
        key: "remark",
        label: "备注",
        placeholder: "备注",
        textarea: true,
        rules: [{
            required: false,
            message: '备注'
        }],
    },
]

const FundInventorySearchKeys = [
    {
        key: "batchNo",
        label: "资金变动批次号",
        placeholder: "请输入资金变动批次号",
        input: true,
        rules: [{
            required: false
        }],
    },
    {
        key: "channel",
        label: "资金渠道",
        placeholder: "请选择资金渠道",
        select: true,
        rules: [{
            required: false
        }],
    },
    {
        key: "flowType",
        label: "资金变动类型",
        placeholder: "请选择资金变动类型",
        select: true,
        rules: [{
            required: false
        }],
    },
    {
        key: "remark",
        label: "备注",
        placeholder: "请输入备注",
        input: true,
        rules: [{
            required: false
        }],
    },
    {
        key: "dates",
        label: "资金变动时间",
        placeholder: "请选择资金变动时间",
        dates: true,
        rules: [{
            required: false
        }],
    },
]
const FundInventoryColumn = [
    { title: '序号', align: 'center', dataIndex:'id' }, 
    { title: '资金变动批次', align: 'center', dataIndex:'batchNo' }, 
    { title: '客户名称', align: 'center', dataIndex:'clientName'  },
    { title: '变更金额', align: 'center', dataIndex: 'flowAmount',customRender: (text,record) =>{ return (record.beforeBalance <= record.afterBalance ?'+':'-') + text} }, 
    { title: '资金渠道', align: 'center', dataIndex:'channel', customRender: text => { let tem = PayChannel.filter(item =>{return item.key == text}); return tem[0] && tem[0].value ? tem[0].value : ''} }, 
    { title: '操作人', align: 'center', dataIndex: 'operator' }, 
    { title: '变更时间', align: 'center', dataIndex:'operateTime',customRender:text =>{return moment(text).format('YYYY-MM-DD HH:mm:ss')}  }, 
    { title: '流水类型', align: 'center', dataIndex:'flowType',customRender:text =>{let tem = FlowTypes.filter(item =>{return item.key == text}); return tem[0] && tem[0].value ? tem[0].value : ''} }, 
    { title: '资金变更前余额', width: 150, align: 'center', dataIndex:'beforeBalance'  }, 
    { title: '资金变更后余额', width: 150, align: 'center', dataIndex:'afterBalance'  }, 
    { title: '备注', align: 'center', dataIndex:'remark'  }, 
    { title: '操作', align: 'center', scopedSlots: { customRender: 'operation' } }
]
const FundInventoryModalKeys = [
    {
        key: "employeeName",
        label: "交易类型",
        placeholder: "请选择交易类型",
        select: true,
        rules: [{
            required: true,
            message: '请选择交易类型'
        }],
    },
    {
        key: "payType",
        label: "支付渠道",
        placeholder: "请选择支付渠道",
        select: true,
        rules: [{
            required: true,
            message: '请选择支付渠道'
        }],
    },
    {
        key: "income",
        label: "净额$",
        placeholder: "净额$",
        inputNumber: true,
        rules: [{
            required: true,
            message: '净额$'
        }],
    },
    {
        key: "billNumber",
        label: "流水号",
        placeholder: "请输入流水号",
        input: true,
        maxLength: 50,
        rules: [{
            required: true,
            message: '请输入流水号'
        }],
    },
    {
        key: "payNumber",
        label: "支付账号",
        placeholder: "请输入支付账号",
        input: true,
        maxLength: 50,
        rules: [{
            required: true,
            message: '请输入支付账号'
        }],
    },
    {
        key: "fee",
        label: "公司承担手续费",
        placeholder: "公司承担手续费",
        inputNumber: true,
        rules: [{
            required: true,
            message: '公司承担手续费'
        }],
    },
    {
        key: "dealTime",
        label: "实际交易时间",
        placeholder: "实际交易时间",
        date: true,
        rules: [{
            required: false,
            message: '实际交易时间'
        }],
    },
    {
        key: "remark",
        label: "备注",
        placeholder: "备注",
        textarea: true,
        rules: [{
            required: false,
            message: '备注'
        }],
    },
]


export {
    FundListSearchKeys, FundListColumn, FundListModalKeys, FundListAddKeys,
    FundInventorySearchKeys, FundInventoryColumn, FundInventoryModalKeys
}